home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEM / I-M / LineShare DEMO.sea / LineShare Scripts / Supra Fax2&ARA < prev    next >
Text File  |  1993-03-10  |  6KB  |  276 lines

  1. !
  2. ! LineShare™ Script for Supra v32bis data-fax modems
  3. ! This script is designed for Class 2 fax software and -
  4. ! ••• Make sure that you have "H" or better ROMs in your modem!
  5. !
  6. ! If you want to modify this script for your modem, pay attention to
  7. ! the line marked "#### Settings ####" - it should be modified first
  8. ! This script is written to use with ARA on the "Data" subPort, so
  9. ! the modem is set to the "no correction/compression" mode
  10. !
  11.  
  12. ! ------------------------------------------
  13. ! Resetting the modem:
  14. ! ------------------------------------------
  15. @Hangup
  16.   SetTries 2
  17.   Flush
  18.   HsReset 0,0,17,19,0,0
  19. !
  20. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  21. ! to enter the command mode
  22. !
  23. @Label 1
  24.   matchclr
  25.   matchstr 1 2 "OK\r\n"
  26.   write "ATH0&F1\r"
  27.   matchread 20
  28.   Write "+++"
  29.   DtrClear
  30.   pause 10
  31.   DtrSet
  32. !
  33.   DecTries
  34.   IfTries 0 1
  35. !
  36. ! OSErr -6019 "Modem error - the modem is not responding"
  37. !
  38.   exit -6019
  39. @Label 2
  40.   write "AT+FCLASS=0\r"
  41.   Jsr 100
  42.   write "AT+FAA=0\r"
  43.   Jsr 100
  44.   exit 0
  45. ! ------------------------------------------
  46. !    Receiving incoming calls
  47. ! ------------------------------------------
  48. @ANSWER
  49. @Label 10
  50. !
  51. ! Set the modem preferred speed first
  52. !
  53.   SERRESET 2400,0,8,1
  54.   Jsr 80
  55. !
  56. ! Set the common options
  57.   Jsr 70
  58. !
  59. ! Set the communication options:
  60. ! • X4:  Extended response set
  61. ! • N1: Connect at the highest rate
  62. ! • \N1: Direct connection (for ARA)
  63. ! • &Q0: Xon/Xoff flow control (for Fax)
  64. ! • &K4: Xon/Xoff flow control (for Fax)
  65. ! • W2:  report connection speed
  66. !
  67. @Label 11
  68. ! #### Settings - change this according to the type of modem you have ####
  69.   Write "ATX4N1\\N1&K4W2\r"
  70.   Jsr 100
  71. !
  72. ! Set the "work" speed
  73. !
  74. @Label 12
  75.   SERRESET 19200,0,8,1
  76.   Jsr 80
  77. !
  78. ! Set Fax parameters: LID, DCC,BOR
  79. !
  80.   Write "AT+FCLASS=2\r"
  81.   Jsr 100
  82.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  83.   Jsr 100
  84.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  85.   Jsr 100
  86.   Write "AT+FBOR=1\r"
  87.   Jsr 100
  88. !
  89. ! Allow modem to receive fax messages
  90. !
  91.   Write "AT+FCR=1\r"
  92.   Jsr 100
  93. !
  94. ! Tell the modem to determine the type of the incoming call
  95. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  96. !
  97.   Write "ATS0=^4+FAA=1\r"
  98.   Jsr 100
  99. !
  100. ! Everything is ready - let's sit and wait for a call
  101. ! We'll wait for 2 minutes, then reinitiate the modem
  102. !
  103. @Label 19
  104.   MatchClr
  105.   matchstr 1 20 "RING\r\n"
  106.   matchstr 2 21 "\r\nCONNECT"
  107.   matchstr 3 24 "\r\n+FCON"
  108.   matchstr 4 10 "\r\nNO "
  109.   matchstr 5 10 "\r\nBUSY"
  110.   Matchread 1200
  111.   jump 10
  112. @Label 20
  113.   Note "Ring…"
  114.   jump 19
  115. !
  116. ! Data connection has been established (we read "CONNECT")
  117. ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
  118. ! if it was an incoming call, put the "RING" before the "CONNECT"
  119. !
  120. @Label 21
  121.   QueueInput "\r\nCONNECT"
  122.   ifOriginate 22
  123.   QueueInput "\r\nRING\r\n"
  124. @Label 22
  125.   Attach "Data" (DTR,Escape,TimeLimit=0)
  126. !
  127. ! Fax connection has been established (we read "+FCON")
  128. ! Put the +FCON back to the buffer,
  129. ! if it was an incoming call, put the "RING" before the "+FCON"
  130. ! Attach the "Fax" subPort
  131. !
  132. @Label 24
  133.   QueueInput "\r\n+FCON"
  134.   ifOriginate 25
  135.   QueueInput "\r\nRING\r\n"
  136. @Label 25
  137.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  138. ! ------------------------------------------
  139. ! Originating a call through the "Data" subport
  140. ! ------------------------------------------
  141. @ORIGINATE "Data"
  142. !
  143. ! Set the Data speed
  144. !
  145.   SERRESET 19200,0,8,1
  146.   Jsr 80
  147. !
  148. ! Set the common options
  149. !
  150.   Jsr 70
  151. !
  152. ! Set the Data mode:
  153. ! • X4:  Extended response set
  154. ! • N1: Connect at the highest rate
  155. ! • \N1: Direct connection (no compression, correction - for ARA)
  156. ! • &S1: DSR according to CCITT (if the cable connects CTS with DSR, not DCD)
  157. ! • S7:  time-out (90 sec) for long-distance call (if you use them)
  158. !
  159. ! #### Settings - change this according to the type of modem you have ####
  160.   Write "ATX4N1\\N1&S1S7=90\r"
  161.   Jsr 100
  162. !
  163. ! Now emit all commands that the application has sent to that port
  164. ! (if we use ARA/LineShare script, no commands were sent)
  165. !
  166.   Jsr 60
  167. !
  168. ! Prepare to receive all error result codes
  169. !
  170.   Jsr 90
  171.   matchstr 1 21 "\r\nCONNECT"
  172. !
  173. ! Dial the number
  174. !
  175.   HsReset *
  176.   Write "ATD^1\r"
  177.   MatchRead 900
  178.   Write "\r"
  179.   Exit -6019
  180. ! ------------------------------------------
  181. ! Originating a call through the "Fax" subPort
  182. ! ------------------------------------------
  183. @ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nNO DIALTONE\r\n")
  184. !
  185. ! Set the "Fax" speed
  186. !
  187.   SERRESET 19200,0,8,1
  188.   Jsr 80
  189. !
  190. ! Set the common options
  191. !
  192.   Jsr 70
  193. !
  194. ! Set the Fax mode
  195. ! &S0: DSR always on (see above)
  196. !
  197.   Write "AT&S0+FCLASS=2\r"
  198.   Jsr 100
  199. !
  200. ! Now emit all commands that the application has sent to that port,
  201. ! Prepare to receive all error result codes
  202. !
  203. @LABEL 50
  204.   Jsr 60
  205.   Jsr 90
  206.   MatchStr 1 24 "\r\n+FCON"
  207.   HsReset *
  208.   Write "ATD^1\r"
  209.   MatchRead 700
  210.   Write "\r"
  211.   Exit -6019
  212. !
  213. ! This section emits all modem commands sent from the client application
  214. ! For each set of commands the "OK" answer is awaited
  215. !
  216. @Label 60
  217.   EmitStart
  218. @Label 61
  219.   EmitCommand 62
  220.   Jsr 100
  221.   Jump 61
  222. @Label 62
  223.   return
  224. !
  225. ! This section initiates the modem before ANSWER and ORIGINATEs:
  226. ! factory settings + speaker control +
  227. ! reset on Dtr drop + DCD valid
  228. ! Verbal responses mode, no echo 
  229. !
  230. @Label 70
  231.   Write "ATM^2L^3&D3&C1V1E0\r"
  232.   Jsr 100
  233.   return 
  234. !
  235. ! This section syncronize the modem after the serial port speed switching
  236. !
  237. @Label 80
  238.   ChrDelay 1
  239.   Write "AT\r"
  240.   ChrDelay 0
  241.   Jsr 100
  242.   return
  243. !
  244. ! Prepare to receive error result codes
  245. !
  246. @Label 90
  247.   MatchClr
  248.   MatchStr 2 91 "NO DIALTONE\r\n"
  249.   MatchStr 3 92 "BUSY\r\n"
  250.   MatchStr 4 93 "NO CARRIER\r\n"
  251.   MatchStr 5 94 "NO ANSWER\r\n"
  252.   return
  253. @Label 91
  254.   exit -6020
  255. @Label 92
  256.   exit -6022
  257. @Label 93
  258.   exit -6021
  259. @Label 94
  260.   exit -6023
  261. !
  262. ! Processing the AT command:
  263. ! OK -> proceed
  264. ! ERROR or TimeOut ->exit -6019
  265. ! It can be called AFTER the "Write" command, since LineShare buffers input
  266. !
  267. @Label 100
  268.   MatchClr
  269.   MatchStr 1 102 "\r\nOK\r\n"
  270.   MatchStr 2 101 "\r\nERROR\r\n"
  271.   MatchRead 20
  272. @Label 101
  273.   Exit -6019
  274. @Label 102
  275.   return
  276.